package c.e.a.b.f.b;

import android.content.ContentValues;
import android.database.sqlite.SQLiteException;
import android.os.Bundle;
import android.text.TextUtils;
import b.i.b.f;
import c.e.a.b.e.c.a1;
import c.e.a.b.e.c.a1.a;
import c.e.a.b.e.c.c1;
import c.e.a.b.e.c.u4;
import com.google.android.gms.measurement.internal.zzap;
import com.google.android.gms.measurement.internal.zzn;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import java.util.Iterator;

/* compiled from: com.google.android.gms:play-services-measurement@@18.0.0 */
public final /* synthetic */ class y4 implements Runnable {
    public final z4 a;
    public final zzn b;
    public final Bundle c;

    public y4(z4 z4Var, zzn zzn, Bundle bundle) {
        this.a = z4Var;
        this.b = zzn;
        this.c = bundle;
    }

    public final void run() {
        zzap zzap;
        z4 z4Var = this.a;
        zzn zzn = this.b;
        Bundle bundle = this.c;
        g K = z4Var.a.K();
        String str = zzn.a;
        K.g();
        K.n();
        u4 u4Var = K.a;
        f.N(str);
        f.N("dep");
        TextUtils.isEmpty("");
        if (bundle == null || bundle.isEmpty()) {
            zzap = new zzap(new Bundle());
        } else {
            Bundle bundle2 = new Bundle(bundle);
            Iterator it = bundle2.keySet().iterator();
            while (it.hasNext()) {
                String str2 = (String) it.next();
                if (str2 == null) {
                    u4Var.d().f.a("Param name can't be null");
                    it.remove();
                } else {
                    Object D = u4Var.t().D(str2, bundle2.get(str2));
                    if (D == null) {
                        u4Var.d().i.b("Param value can't be null", u4Var.u().x(str2));
                        it.remove();
                    } else {
                        u4Var.t().I(bundle2, str2, D);
                    }
                }
            }
            zzap = new zzap(bundle2);
        }
        q9 m = K.m();
        a M = a1.M();
        if (M.c) {
            M.j();
            M.c = false;
        }
        a1.E((a1) M.b, 0);
        for (String str3 : zzap.a.keySet()) {
            c1.a Q = c1.Q();
            Q.o(str3);
            m.F(Q, zzap.b(str3));
            M.o(Q);
        }
        byte[] i = ((a1) ((u4) M.l())).i();
        K.d().n.c("Saving default event parameters, appId, data size", K.j().u(str), Integer.valueOf(i.length));
        ContentValues contentValues = new ContentValues();
        contentValues.put(HiAnalyticsConstant.BI_KEY_APP_ID, str);
        contentValues.put("parameters", i);
        try {
            if (K.t().insertWithOnConflict("default_event_params", null, contentValues, 5) == -1) {
                K.d().f.b("Failed to insert default event parameters (got -1). appId", q3.s(str));
            }
        } catch (SQLiteException e) {
            K.d().f.c("Error storing default event parameters. appId", q3.s(str), e);
        }
    }
}
